<!DOCTYPE html>
<head>
    <#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
    <#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
    <meta charset="utf-8">
    <title>飞行试验奖惩进度明细</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <#if isClose == 'true'>
    <style>
        .listBody .qbdms-bodyDiv{padding: 0 }
        body.qbdms-particulars .qbdms-bodyDiv div.layui-table-view-body{padding: 16px}
        .btnformItem{background: none}
    </style>
</#if>
</head>
<body class="listBody qbdms-particulars">
<div class="qbdms-bodyDiv">
    <div class="layui-table-view-body qbdms-add-view-body">
        <#if isClose != 'true'><div class="qbdms-formTitle">飞行试验奖惩进度明细 <i class="qbdms-returnOn closeWindow">返回</i></div></#if>
        <form class="formPreview layui-form" requrl="${ctx}/qbdms/wQbdFlightJc/getJCDataByid" lay-filter="wQbdFlightJcDataForm">
            <div class="" style="width: 100%;overflow-x: auto">
                <table class="tableExcel qbdms-zeroTable" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr id="tbxx"></tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            飞行试验名称<span style="color: red;">*</span>
                        </td>
                        <td name="fxsymc"></td>
                        <td class="qbdms-zeroTable-lable">
                            密级<span style="color: red;">*</span>
                        </td>
                        <td>
                            <@secSelect.sec_select data_src=1 required=true name="secret"/>
                        </td>
                        <td class="qbdms-zeroTable-lable">
                            年度<span style="color: red;">*</span>
                        </td>
                        <td name="nd"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            型号名称<span style="color: red;">*</span>
                        </td>
                        <td name="xhmc"></td>
                        <td class="qbdms-zeroTable-lable">
                            项目类型<span style="color: red;">*</span>
                        </td>
                        <td name="xmlx"></td>
                        <td class="qbdms-zeroTable-lable">
                            总体单位名称<span style="color: red;">*</span>
                        </td>
                        <td name="ztswmcstr"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            项目类别<span style="color: red;">*</span>
                        </td>
                        <td name="xmlb"></td>
                        <td class="qbdms-zeroTable-lable">
                            项目阶段<span style="color: red;">*</span>
                        </td>
                        <td name="xmjd"></td>
                        <td class="qbdms-zeroTable-lable">
                            初始奖励额度（万元）<span style="color: red;">*</span>
                        </td>
                        <td name="csjled"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            初始处罚额度（万元）<span style="color: red;">*</span>
                        </td>
                        <td name="cscfed"></td>
                        <td class="qbdms-zeroTable-lable">
                            产品价格（参考值）（万元）<span style="color: red;">*</span>
                        </td>
                        <td name="cpjg"></td>
                        <td class="qbdms-zeroTable-lable">
                            P值<span style="color: red;">*</span>
                        </td>
                        <td name="pz"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            计划奖励总额度（万元）<span style="color: red;">*</span>
                        </td>
                        <td name="jhjlzed"></td>
                        <td class="qbdms-zeroTable-lable">
                            计划处罚总额度（万元）<span style="color: red;">*</span>
                        </td>
                        <td name="jhcfzed"></td>
                        <td class="qbdms-zeroTable-lable">
                            备注<span style="color: red;">*</span>
                        </td>
                        <td name="bz"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            附件
                        </td>
                        <td colspan="5">
                            <div class="uploadFileList" fileUploadName="fj"></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            奖励工资总额合计（万元）<span style="color: red;">*</span>
                        </td>
                        <td name="jlgzzehj"></td>
                        <td class="qbdms-zeroTable-lable">
                            减免利润上缴合计<span style="color: red;">*</span>
                        </td>
                        <td name="jmlrsjhj"></td>
                        <td class="qbdms-zeroTable-lable">
                            主管部门<span style="color: red;">*</span>
                        </td>
                        <td name="zgbm"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <p class="qbdms-SubTableTitle"><span>奖惩金额分配</span></p>
            <div class="qbdms-tableDiv">
                <a modetype="2" class="addFormTr1" id="add"><i class="layui-icon layui-icon-addition"></i>新增</a>
                <table class="qbdms-temTable wQbdFlightJczbList subFormTable" id="wQbdFlightJczbList" style="min-width: 2790px;">
                    <tbody>
                    <tr class="temSpace qbdms-temTable-thead">
                        <td class="temSpace" style="width: 30px;">序号</td>
                        <td class="temSpace subDialogShowState">奖励单位名称<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 150px">单位类别<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 90px">分配比例(%)<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 170px">计划最高奖励额度（万元)<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 175px">计划最高处罚额度（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 175px">奖励工资总额合计（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 175px">减免利润上缴合计（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 160px">实际奖励额度（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 160px">实际处罚额度（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 250px">以奖励工资总额形式兑现合计（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 205px">以奖励工资总额形式兑现日期<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 250px">以减免利润上缴形式兑现合计（万元）<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 195px">以减免利润上缴形式兑现日期<span style="color: red;">*</span></td>
                    </tr>
                    <tr class="temSpace subContTem">
                        <td class="temSpace qbdms-temTable-seNumber">
                            <div class="temTag">0</div>
                        </td>
                        <td class="temSpace qbdms-temTable-td" name="s:wQbdFlightJczbList:jlswmcstr"></td>
                        <td class="temSpace qbdms-temTable-td" name="s:wQbdFlightJczbList:swlb"></td>
                        <td class="temSpace qbdms-temTable-td" name="s:wQbdFlightJczbList:fpbl"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:jhzgjled"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:jhzgcfed"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:jlgzzehj"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:jmlrsjhj"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:sjjled"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:sjcfed"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:yjlgzzexsdxhj"></td>
                        <td class="temSpace qbdms-temTable-td" name="s:wQbdFlightJczbList:yjlgzzexsdxrq"></td>
                        <td class="temSpace qbdms-temTable-td qbdms-money" name="s:wQbdFlightJczbList:yjmlrsjxsdxhj"></td>
                        <td class="temSpace qbdms-temTable-td" name="s:wQbdFlightJczbList:yjmlrsjxsdxrq"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <#if isClose != 'true'>
            <div class="layui-form-item btnformItem">
                <p>
                    <button type="reset" id="closeWindow"
                            class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">返回
                    </button>
                </p>
            </div>
            </#if>
        </form>
    </div>
</div>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>

<script>

    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'layer', 'propsHandle',  'common',  'jquery', 'publicMethods', 'qbdmsForm'], function () {

        // -----常量声明----------
        var $ = layui.jquery,
            setter = layui.setter,  // 配置信息
            common = layui.common,
            propsHandle = layui.propsHandle,
            publicMethods = layui.publicMethods,
            defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle(),  // 实例化模板功能部分
            form = layui.qbdmsForm;
        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        $(".subContTem").hide();
        // 子表初始化事件
        temQuery.initSubEvent(defProps, serverPath, setter);

        var count = 1;
        $(document).on('click', '.addFormTr1', function () {
            count += 1;
            var modetype = $(this).attr('modetype'),
                copyObj = $(this).parent().children('.subFormTable'),
                copyHtm = copyObj.find('tr').eq(1);
            if (modetype === '2') {
                //在这里做一个转换，控制子表隐藏行的必填
                var copyHtmlStr = copyHtm.html();
                copyHtmlStr = copyHtmlStr.replace(/requiredflag/g, "lay-verify");
                // 表格
                copyObj.append('<tr class="temSpace">' + copyHtmlStr + '</tr>');
                // copyObj.append('<tr class="temSpace">' + copyHtm.html() + '</tr>');
                var trArr = copyObj.find('tr');
                trArr.eq(trArr.length - 1).find('td').eq(0).find('.temTag').html(trArr.length - 2);
                // trArr.eq(trArr.length - 1).find('td').eq(6).find('button').attr("id","fSkillcerfileList"+count);
                trArr.eq(trArr.length - 1).find('.fileUpload').attr("id", "fSkillcerfileList" + count);

                trArr.eq(trArr.length - 1).find('[isinit="1"]').each(function (i, item) {
                    $(item).attr('isinit', '2');
                });
                if (trArr.length > 3) {
                    trArr.eq(trArr.length - 1).find('[type=radio]').each(function (i, item) {
                        $(item).attr('name', (trArr.eq(1).find('[type=radio]').eq(i).attr('name')) + '_' + (trArr.length - 2))
                    });
                }
                temQuery.initTemEvent(defProps, serverPath, setter);
            } else if (modetype === '1') {
                // updateTr(copyObj, copyHtm);
            }
            form.render();
            publicMethods.bottomFixd()
        });

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            if ("${isClose}" == "true") {
                parent.layer.close(parent.layer.getFrameIndex(window.name));
            }
            window.location.href = '${ctx}/qbdms/wQbdFlightJc/view/processList';
        });

        common.updateForm({
            name: 'wQbdFlightJcDataForm',
            idValue: "${id}",
            primary: "id",
            getCallback: function (data) {
                $("#tbxx").html("<td class='qbdms-zeroTable-lable'>填报信息:</td><td colspan='5'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</td>");
                $("#nd").val(eval(data.data).nd.substring(0,4));
                //-明细页面 初始化附件组件 开始 ------------------------------------------
                $('.uploadFileList').each(function () {
                    var fileUploadName = $(this).attr("fileUploadName");
                    var jsonFile = data.data[fileUploadName];
                    var files = eval(jsonFile);

                    if (files) {
                        for (var i = 0; i < files.length; i++) {
                            var fileLevel = files[i].fileLevel;
                            var fileLevelText = files[i].fileLevelText;
                            var fileSec = '<div class="fileSecLevel fileSecXg layui-input-inline">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
                            var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)">' + files[i].fileName + '</span></span>';
                            $(this).html(newStr);
                            $(this).find("select:last").val(fileLevel);
                            $(this).find("select:last").attr("disabled", "disabled");
                        }
                    }else {
                        $(this).html("<span style='color: #c0c4cc'>未上传</span>");
                    }
                });
                //-明细页面 初始化附件组件 结束 ------------------------------------------
                $("#xhmc").val(data.data.xhmc);
                form.render();
                $('table.subFormTable').each(function () {
                    var table = {
                        tableName: $(this).attr('class').split(" ")[1],
                        fields: []
                    };
                    table.fields = data.data[table.tableName];
                    if(table.fields.length==0){
                        $(this).parent(".qbdms-tableDiv").append("<p>无数据</p>")
                    }else {
                        $(this).parent(".qbdms-tableDiv").css('padding',"0px")
                    }
                    for (var i = 0, len = table.fields.length; i < len; i++) {
                        var dataRow = table.fields[i];
                        var temp = $("." + table.tableName).prev().click();
                        //这里有子表表头占一行，子表隐藏行占一行，所以取需要赋值的行时，需要temp=i+2
                        var domRow = $(this).find("tr.temSpace:eq(" + (i * 1 + 2) + ")");
                        $.each(dataRow, function (j, val) {
                            var domItem = domRow.find("[name$='" + j + "']");
                            if (domItem) {
                                domItem.html(val);
                            }
                        });
                    }
                });
            }
        });

        //下载附件
        window.downFile = function (obj) {
            var fileId = $(obj).parents("span").attr("fileId");
            window.location.href = serverPath.qbdmsPath + setter.extendLinkPath + "attachFile/download?fileId=" + fileId;
        };

        if ("${isClose}" == "true") {
            $(".closeWindow").hide();
        }
        publicMethods.bottomFixd()
        $("body *").not("#closeWindow").attr("disabled", "disabled");
        $(".uploadFileCont .qbdms-fileUp,.uploadFileCont i,.addFormTr1").hide();
    });
</script>
</body>
</html>